<!doctype html>
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
  <meta charset="utf-8">
  <script src="../../../web-component-tester/browser.js"></script>
  <script src="../../../webcomponentsjs/webcomponents.js"></script>
</head>
<body>

  <link rel="import" href="../../polymer.html">

  <script>
    if (window.Polymer) {
      Polymer({
        is: 'x-fire',
        ready: function() {
          this.fire('fired');
        }
      })
    }
  </script>

  <template is="dom-bind" id="domBind">
    <x-fire on-fired="fired"></x-fire>
  </template>

  <script>
    if (window.Polymer) {
      var now = Date.now() + 1000;
      while (Date.now() < now) {
        Math.random();
      }
    }
  </script>

  <script>
    window.domBind.fired = function() {
      this.didFire = true;
    }
  </script>

  <script>

    if (window.Polymer) {

      suite('bind stamps after page fully loads (despite yielding)', function() {

        test('event handled', function() {
          assert.isTrue(window.domBind.didFire);
        });

      });

    }

  </script>
</body>
</html>
